package com.xmy.cultivate.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.xmy.cultivate.entity.Organization;
import com.xmy.cultivate.entity.response.YearAndQuarter;
import com.xmy.cultivate.mapper.OrganizationMapper;
import com.xmy.cultivate.respons.ResSchool;
import com.xmy.cultivate.service.IOrganizationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 组织机构 服务实现类
 * </p>
 *
 * @author min
 * @since 2022-07-26
 */
@Service
public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Organization> implements IOrganizationService {

    @Autowired
    OrganizationMapper organizationMapper;


    public List<Long> getOrganiztionId(Wrapper wrapper) {
        return organizationMapper.getOrganiztionId(wrapper);
    }

    @Override
    public String getSchoolName(Long schoolId) {
        return organizationMapper.getSchoolName(schoolId);
    }

    @Override
    public List<ResSchool> getSchoolForYearAndNum(List<YearAndQuarter> yearAndQuarterList) {
        return organizationMapper.getSchoolForYearAndNum(yearAndQuarterList);
    }

    @Override
    public List<Long> getSchoolmasterIdList(Integer yearPart, Integer quarterNum) {
        return organizationMapper.getSchoolmasterIdList(yearPart, quarterNum);
    }

    @Override
    public String schoolmasterIdByAdminId(Integer yearPart, Integer quarterNum, Long adminId) {
        return organizationMapper.schoolmasterIdByAdminId(yearPart, quarterNum, adminId);
    }
    /**
     * 是否校长
     */
    @Override
    public Integer getIsManager(@Param("yearPart") Integer yearPart, @Param("quarterNum") Integer quarterNum, @Param("teacherId") Long teacherId){
        return organizationMapper.getIsManager(yearPart,quarterNum,teacherId);
    }
}
